package com.taotao.wjspringboot;

import com.taotao.wjspringboot.config.KtConfig;
import com.taotao.wjspringboot.entity.UserEntity;
import com.taotao.wjspringboot.service.KtService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author wangjin
 * @title: AppTest01
 * @projectName wj-springboot
 * @description:
 * @date 2021/10/23 15:23
 */
public class AppTest01 {
    public static void main(String[] args) {
/*      ClassPathXmlApplicationContext app=  new ClassPathXmlApplicationContext("applicationContext.xml");
        UserEntity userEntity=app.getBean("userEntity",UserEntity.class);
        System.out.println(userEntity);*/
        /**
         * 1,xml配置文件转化为注解的形式
         * 2，如何使用注解的形式注入Bean
         */
        AnnotationConfigApplicationContext app = new AnnotationConfigApplicationContext(KtConfig.class);
        UserEntity userEntity = app.getBean("userEntity", UserEntity.class);
        System.out.println(userEntity);
        KtService ktService = app.getBean("ktService", KtService.class);
        System.out.println(ktService);
    }
}
